﻿
//Function, contains methods for the date and time.
LightScript.using("LightScript.Core", function()
{
    var thisClass = LightScript.Core.createClass("LightScript.DateTime");

    //# Private Members
    
    //# Constructions
    
    //# Public Members
    thisClass.addYears = function(date, n)
    {
        var d1 = new Date(date.getFullYear(), date.getMonth(), date.getDate());
        var d2 = new Date(date.getFullYear()+n, date.getMonth(), date.getDate());
        var diff = d2 - d1;
        return new Date(date.getTime() + diff);
    }

    thisClass.addMonths = function(date, n)
    {
        var d1 = new Date(date.getFullYear(), date.getMonth(), date.getDate());
        var d2 = new Date(date.getFullYear(), date.getMonth()+n, date.getDate());
        var diff = d2 - d1;
        return new Date(date.getTime() + diff);
    }

    thisClass.addDays = function(date, n)
    {
        return new Date(date.getTime() + n*24*60*60*1000);
    }
    
    //# Private Methods
    
    //# Public Methods

    //# Shortcuts
});
